package org.jeecg.common.handler;


import lombok.Data;
import lombok.experimental.Accessors;
import org.jeecg.common.model.BaseImportModel;

import java.util.HashMap;
import java.util.Map;

/**
 * 数据范围控制
 * @author mzz
 */
@Data
@Accessors(chain = true)
public class DataScopeHandler {
    private String personalSql;
    private String orgSql;
    private String orgTreeSql;
    private String customSql;//自定义sql
    private Map<String,Object> personalParmMap ;
    private Map<String,Object> orgParmMap ;
    private Map<String,Object> orgTreeParmMap ;
    private Map<String,Object> customParmMap ;

    public DataScopeHandler setPersonalParms(String key,Object value){
        if(personalParmMap==null){
            personalParmMap = new HashMap<>();
        }
        personalParmMap.put(key,value);
        return this;
    }
    public DataScopeHandler setOrgParms(String key,Object value){
        if(orgParmMap==null){
            orgParmMap = new HashMap<>();
        }
        orgParmMap.put(key,value);
        return this;
    }
    public DataScopeHandler setOrgTreeParms(String key,Object value){
        if(orgTreeParmMap==null){
            orgTreeParmMap = new HashMap<>();
        }
        orgTreeParmMap.put(key,value);
        return this;
    }

    public DataScopeHandler setCustomParms(String key,Object value){
        if(customParmMap==null){
            customParmMap = new HashMap<>();
        }
        customParmMap.put(key,value);
        return this;
    }

}
